package com.yami.shop.api.controller;


import com.yami.shop.bean.app.dto.ShopDetailDto;
import com.yami.shop.bean.model.ShopDetail;
import com.yami.shop.service.ShopDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import ma.glasnost.orika.MapperFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户信息
 *
 * @author SJL
 */
@RestController
@RequestMapping("/shop")
@Api(tags = "企业相关信息")
@AllArgsConstructor
public class ShopInfoController {

    @Autowired
    private ShopDetailService shopDetailService;

    private final MapperFacade mapperFacade;

    /**
     * 查看用户接口
     */
    @GetMapping("/shopInfo")
    @ApiOperation(value="查看公司基本信息", notes="获取公司基本信息")
    public ResponseEntity<ShopDetailDto> shopInfo() {
        ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(1L);
        ShopDetailDto shopDetailDto = mapperFacade.map(shopDetail, ShopDetailDto.class);
        return ResponseEntity.ok(shopDetailDto);
    }


}
